﻿using PivotCollectionTools.Xml;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.ObjectModel;
using System;

namespace PivotCollectionTools.Xml.Test
{
    
    
    /// <summary>
    ///This is a test class for FacetTest and is intended
    ///to contain all FacetTest Unit Tests
    ///</summary>
    [TestClass()]
    public class FacetTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Text
        ///</summary>
        [TestMethod()]
        public void Facet_Text_Test()
        {
            string expectedValue1 = "Value1";
            string expectedValue2 = "Value2";

            Facet target = new Facet(); // TODO: Initialize to an appropriate value
            target.Text.Add(new FacetStringType(expectedValue1));
            target.Text.Add(new FacetStringType(expectedValue2));

            Collection<FacetStringType> actual;
            actual = target.Text;

            Assert.AreEqual(expectedValue1, actual[0].Value);
            Assert.AreEqual(expectedValue2, actual[1].Value);
        }

        /// <summary>
        ///A test for Number
        ///</summary>
        [TestMethod()]
        public void Facet_Number_Test()
        {
            decimal expectedValue1 = 9.9m;
            decimal expectedValue2 = 1.1m;

            Facet target = new Facet(); // TODO: Initialize to an appropriate value
            target.Number.Add(new FacetNumberType(expectedValue1));
            target.Number.Add(new FacetNumberType(expectedValue2));

            Collection<FacetNumberType> actual;
            actual = target.Number;

            Assert.AreEqual(expectedValue1, actual[0].Value);
            Assert.AreEqual(expectedValue2, actual[1].Value);
        }

        /// <summary>
        ///A test for LongString
        ///</summary>
        [TestMethod()]
        public void Facet_LongString_Test()
        {
            string expectedValue1 = "Value1";
            string expectedValue2 = "Value2";

            Facet target = new Facet(); // TODO: Initialize to an appropriate value
            target.LongString.Add(new FacetStringType(expectedValue1));
            target.LongString.Add(new FacetStringType(expectedValue2));

            Collection<FacetStringType> actual;
            actual = target.LongString;

            Assert.AreEqual(expectedValue1, actual[0].Value);
            Assert.AreEqual(expectedValue2, actual[1].Value);
        }

        /// <summary>
        ///A test for Link
        ///</summary>
        [TestMethod()]
        public void Facet_Link_Test()
        {
            var expectedValue1 = new Uri("http://test.com/");
            string name1 = "name1";
            var expectedValue2 = new Uri("http://test2.com/");
            string name2 = "name2";

            Facet target = new Facet(); // TODO: Initialize to an appropriate value
            target.Link.Add(new FacetLinkType(name1, expectedValue1));
            target.Link.Add(new FacetLinkType(name2, expectedValue2));

            Collection<FacetLinkType> actual;
            actual = target.Link;

            Assert.AreEqual(expectedValue1.ToString(), actual[0].Href);
            Assert.AreEqual(expectedValue2.ToString(), actual[1].Href);
        }

        /// <summary>
        ///A test for FacetName
        ///</summary>
        [TestMethod()]
        public void Facet_FacetName_Test()
        {
            Facet target = new Facet();
            string expected = "testName";
            string actual;
            target.FacetName = expected;
            actual = target.FacetName;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for DateTime
        ///</summary>
        [TestMethod()]
        public void Facet_DateTime_Test()
        {
            var expectedValue1 = DateTime.Now;
            var expectedValue2 = DateTime.Now;

            Facet target = new Facet(); // TODO: Initialize to an appropriate value
            target.DateTime.Add(new FacetDateTimeType(expectedValue1));
            target.DateTime.Add(new FacetDateTimeType(expectedValue2));

            Collection<FacetDateTimeType> actual;
            actual = target.DateTime;

            Assert.AreEqual(expectedValue1, actual[0].Value);
            Assert.AreEqual(expectedValue2, actual[1].Value);
        }

        /// <summary>
        ///A test for Facet Constructor
        ///</summary>
        [TestMethod()]
        public void Facet_Constructor_Test()
        {
            Facet target = new Facet();
            Assert.IsNotNull(target);
        }

        /// <summary>
        ///A test for Facet Constructor
        ///</summary>
        [TestMethod()]
        public void Facet_Constructor_Name_Test()
        {
            string facetName = "testName";
            Facet target = new Facet(facetName);
            Assert.AreEqual(facetName, target.FacetName);
        }
    }
}
